package com.example.demo.service;

import com.example.demo.mapper.ArticleMapper;
import com.example.demo.model.ArticleInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 马拉圈
 * Date: 2023-09-03
 * Time: 20:36
 */
@Service
public class ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    public int publish(ArticleInfo articleInfo) {
        return articleMapper.insert(articleInfo);
    }

    public List<ArticleInfo> getListByUid(int uid) {
        return articleMapper.getListByUid(uid);
    }

    public int delete(ArticleInfo articleInfo) {
        return articleMapper.delete(articleInfo);
    }

    public ArticleInfo getArt(ArticleInfo articleInfo) {
        return articleMapper.getArticleCheck(articleInfo);
    }

    public int update(ArticleInfo articleInfo) {
        return articleMapper.updateArticle(articleInfo);
    }

    public ArticleInfo getArtByAid(ArticleInfo articleInfo) {
        return articleMapper.getArticle(articleInfo);
    }

    public int getArtNumberByUid(int uid) {
        return articleMapper.getArtNumberByUid(uid);
    }

    public int incrementRCount(int aid) {
        return articleMapper.incrementRCount(aid);
    }

    public List<ArticleInfo> getSubList(int limit, int offset) {
        return articleMapper.getSubList(limit, offset);
    }

    public int getNumber() {
        return articleMapper.getNumber();
    }
}
